<form action="index.php" method="get">
  <select size='6' name="id">
    <?php foreach($msgs as $msg):
       if(!isset($_SESSION['zalogowany']) && $msg['registered']){
         $disabledstr = 'disabled="disabled"';
       }
       else{
         $disabledstr = '';
       }
    ?>
    <option value="<?php echo $msg['id']?>"
      <?php echo $disabledstr; ?>><?php echo $msg['title']?>
    </option>
    <?php
      endforeach;
    ?>
  </select>
  <input type="hidden" name="action" value="showmsg">
  <input type="submit" value="Sprawdź wiadomość">
</form>
